<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMembersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('members', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('store_id')->index()->nullable()->comment('门店ID');
            $table->string('name',190)->index()->nullable()->comment('会员姓名');
            $table->integer('sex')->index()->nullable()->comment('会员性别：1男、2女');
            $table->string('birthday',190)->nullable()->comment('会员生日');
            $table->string('number',190)->nullable()->comment('会员卡号');
            $table->string('mobile',20)->nullable()->comment('会员手机号码');
            $table->integer('member_level_id')->index()->nullable()->comment('会员等级ID');
            $table->integer('balance')->index()->default(0)->comment('余额：单位分');
            $table->integer('total_grand')->index()->default(0)->comment('累计消费');
            $table->integer('integral')->index()->default(0)->comment('积分');
            $table->integer('cashier_id')->index()->nullable(0)->comment('收银员ID');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('members');
    }
}
